﻿//创建时间: 2010-10-12
//创建作者: 李晓忠
//功能说明: CMS系统 发布模式管理 
//最后修改: 2010-10-12
using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using TRPOP.Common;
using TRPOP.CMS.Web.UI;


using TRPOP.CMS.Business;
using TRPOP.CMS.Model;

namespace TRPOP.CMS.Web.Admin
{
    public partial class ContentPubType_list : BaseAdmin
    {
        #region 当前页面权限验证
        protected override void SubPageInit()
        {
            base.m_SubPagePermission = Plugin.PermissionKeys.PermissionEnum.Node_Save;
        }
        #endregion

        #region 页面变量
        protected string m_strTitle = "结点类型管理";
        ContentPubTypeManage oContentPubTypeManage = new ContentPubTypeManage();
        #endregion

        #region 页面事件
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadBase();
            }
        }
        protected void lbtnDelete_Click(object sender, EventArgs e)
        {
            LinkButton lbtn = (LinkButton)sender;
            int intFormInputLimitTypeId = 0;
            int.TryParse(lbtn.CommandArgument, out intFormInputLimitTypeId);
            SubmitAlertDelete(oContentPubTypeManage.DeleteInfoById(intFormInputLimitTypeId));
            LoadBase();
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string strMSG = "名称";
            if (!PageAssist.CheckForm(txtName, ref strMSG))
            {
                Alert(strMSG);
                return;
            }
            if (!txtDisposeNum.Text.IsNumeric())
            {
                Alert("列表前N页静态值必须是数字类型"); return;
            }

            ContentPubTypeInfo oContentPubTypeInfo = new ContentPubTypeInfo();
            oContentPubTypeInfo.DisposeNum = txtDisposeNum.TextTrim.ToInt();
            oContentPubTypeInfo.Name = txtName.TextTrim.RemoveHtml();
            oContentPubTypeInfo.IsStatic = chkIsStatic.Checked;
            SubmitAlert(oContentPubTypeManage.Save(oContentPubTypeInfo));
            LoadBase();
        }
        #endregion

        #region 页面方法
        public void LoadBase()
        {

            txtName.Text = "";
            txtDisposeNum.Text = "";
            chkIsStatic.Checked = false;
            rptList.DataSource = oContentPubTypeManage.GetListByCondition(0, "", " ContentPubTypeId asc");
            rptList.DataBind();
        }
        #endregion
    }
}
